package com.np.retrofit211demo1.retrofit;

import androidx.lifecycle.MutableLiveData;

import com.np.retrofit211demo1.bean.AccessTokenBean;
import com.np.retrofit211demo1.bean.RecordBean;
import com.np.retrofit211demo1.bean.UserBean;

public class LiveDataCenter {
    // 登录信息
    private static final MutableLiveData<AccessTokenBean> accessToken = new MutableLiveData<>();
    // 当前用户信息
    private static final MutableLiveData<UserBean> currentUser = new MutableLiveData<>();
    // 当前操作的病历
    private static final MutableLiveData<RecordBean> currentRecord = new MutableLiveData<>();

    public static void setAccessToken(AccessTokenBean accessToken) {
        //LiveDataCenter.accessToken.postValue(accessToken);
        LiveDataCenter.accessToken.setValue(accessToken);
    }

    public static MutableLiveData<AccessTokenBean> getAccessToken() {
        return accessToken;
    }

    public static void setCurrentUser(UserBean currentUser) {
        //LiveDataCenter.currentUser.postValue(currentUser);
        LiveDataCenter.currentUser.setValue(currentUser);
    }

    public static MutableLiveData<UserBean> getCurrentUser() {
        return currentUser;
    }

    public static MutableLiveData<RecordBean> getCurrentRecord() {
        return currentRecord;
    }

    public static void setCurrentRecord(RecordBean record) {
        // LiveDataCenter.currentRecord.postValue(record);
        LiveDataCenter.currentRecord.setValue(record);
    }
}
